home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / elispman.lha / elispman / elisp-34 (.txt) < prev    next >
GNU Info File  |  1993-05-11  |  47KB  |  733 lines

  1. This is Info file elisp, produced by Makeinfo-1.52 from the input file
  2. elisp.texi.
  3.    This file documents GNU Emacs Lisp.
  4.    This is edition 2.0 of the GNU Emacs Lisp Reference Manual, for
  5. Emacs Version 19.
  6.    Published by the Free Software Foundation, 675 Massachusetts Avenue,
  7. Cambridge, MA 02139 USA
  8.    Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: elisp,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
  21. Display Table Format
  22. --------------------
  23.                                       A display table is actually an
  24. array of 261 elements.
  25.                                     - Function: make-display-table
  26.                                         This creates and returns a
  27.                                         display table.  The table
  28.                                         initially has `nil' in all
  29.                                         elements.
  30.                                       The first 256 elements correspond
  31. to character codes; the Nth element says how to display the character
  32. code N.  The value should be `nil' or a vector of glyph values (*note
  33. Glyphs::.).  If an element is `nil', it says to display that character
  34. according to the usual display conventions (*note Usual Display::.).
  35.                                       The remaining five elements of a
  36. display table serve special purposes, and `nil' means use the default
  37. stated below.
  38.                                   256
  39.                                         The glyph for the end of a
  40.                                         truncated screen line (the
  41.                                         default for this is `$').
  42.                                         *Note Glyphs::.
  43.                                   257
  44.                                         The glyph for the end of a
  45.                                         continued line (the default is
  46.                                         `\').
  47.                                   258
  48.                                         The glyph for indicating a
  49.                                         character displayed as an octal
  50.                                         character code (the default is
  51.                                         `\').
  52.                                   259
  53.                                         The glyph for indicating a
  54.                                         control character (the default
  55.                                         is `^').
  56.                                   260
  57.                                         A vector of glyphs for
  58.                                         indicating the presence of
  59.                                         invisible lines (the default is
  60.                                         `...').  *Note Selective
  61.                                         Display::.
  62.                                       For example, here is how to
  63. construct a display table that mimics the effect of setting `ctl-arrow'
  64. to a non-`nil' value:
  65.                                         (setq disptab (make-display-table))
  66.                                         (let ((i 0))
  67.                                           (while (< i 32)
  68.                                             (or (= i ?\t) (= i ?\n)
  69.                                                 (aset disptab i (vector ?^ (+ i 64))))
  70.                                             (setq i (1+ i)))
  71.                                           (aset disptab 127 (vector ?^ ??)))
  72. File: elisp,  Node: Active Display Table,  Next: Glyphs,  Prev: Display Table Format,  Up: Display Tables
  73. Active Display Table
  74. --------------------
  75.                                       Each window can specify a display
  76. table, and so can each buffer.  When a buffer B is displayed in window
  77. W, display uses the display table for window W if it has one;
  78. otherwise, the display table for buffer B if it has one; otherwise, the
  79. standard display table if any.  The display table chosen is called the
  80. "active" display table.
  81.                                     - Function: window-display-table
  82.                                              WINDOW
  83.                                         This function returns WINDOW's
  84.                                         display table, or `nil' if
  85.                                         WINDOW does not have an
  86.                                         assigned display table.
  87.                                     - Function:
  88.                                              set-window-display-table
  89.                                              WINDOW TABLE
  90.                                         This function sets the display
  91.                                         table of WINDOW to TABLE.  The
  92.                                         argument TABLE should be either
  93.                                         a display table or `nil'.
  94.                                     - Variable: buffer-display-table
  95.                                         This variable is automatically
  96.                                         local in all buffers; its value
  97.                                         in a particular buffer is the
  98.                                         display table for that buffer,
  99.                                         or `nil' if the buffer does not
  100.                                         have any assigned display table.
  101.                                     - Variable: standard-display-table
  102.                                         This variable's value is the
  103.                                         default display table, used
  104.                                         when neither the current buffer
  105.                                         nor the window displaying it
  106.                                         has an assigned display table.
  107.                                         This variable is `nil' by
  108.                                         default.
  109.                                       If neither the selected window
  110. nor the current buffer has a display table, and if the variable
  111. `standard-display-table' is `nil', then Emacs uses the usual display
  112. conventions.  *Note Usual Display::.
  113. File: elisp,  Node: Glyphs,  Next: ISO Latin 1,  Prev: Active Display Table,  Up: Display Tables
  114. Glyphs
  115. ------
  116.                                       A "glyph" is a generalization of
  117. a character; it stands for an image that takes up a single character
  118. position on the screen.  Glyphs are represented in Lisp as integers,
  119. just as characters are.
  120.                                       The meaning of each integer, as a
  121. glyph, is defined by the glyph table, which is the value of the
  122. variable `glyph-table'.
  123.                                     - Variable: glyph-table
  124.                                         The value of this variable is
  125.                                         the current glyph table.  It
  126.                                         should be a vector; the Gth
  127.                                         element defines glyph code G.
  128.                                         If the value is `nil' instead
  129.                                         of a vector, then all glyphs
  130.                                         are simple (see below).
  131.                                       Here are the possible types of
  132. elements in the glyph table:
  133.                                   INTEGER
  134.                                         Define this glyph code as an
  135.                                         alias for code INTEGER.  This
  136.                                         is used with X windows to
  137.                                         specify a face code.
  138.                                   STRING
  139.                                         Send the characters in STRING
  140.                                         to the terminal to output this
  141.                                         glyph.  This alternative is not
  142.                                         available with X Windows.
  143.                                   `NIL'
  144.                                         This glyph is simple.  On an
  145.                                         ordinary terminal, the glyph
  146.                                         code mod 256 is the character
  147.                                         to output.  With X, the glyph
  148.                                         code mod 256 is character to
  149.                                         output, and the glyph code
  150.                                         divided by 256 specifies the
  151.                                         "face id number" to use while
  152.                                         outputting it.  *Note Faces::.
  153.                                       If a glyph code is greater than
  154. or equal to the length of the glyph table, that code is automatically
  155. simple.
  156. File: elisp,  Node: ISO Latin 1,  Prev: Glyphs,  Up: Display Tables
  157. ISO Latin 1
  158. -----------
  159.                                       If you have a terminal that can
  160. handle the entire ISO Latin 1 character set, you can arrange to use
  161. that character set as follows:
  162.                                         (require 'disp-table)
  163.                                         (standard-display-8bit 0 255)
  164.                                       If you are editing buffers
  165. written in the ISO Latin 1 character set and your terminal doesn't
  166. handle anything but ASCII, you can load the file `iso-ascii' to set up
  167. a display table which makes the other ISO characters display as
  168. sequences of ASCII characters.  For example, the character "o with
  169. umlaut" displays as `{"o}'.
  170.                                       Some European countries have
  171. terminals that don't support ISO Latin 1 but do support the special
  172. characters for that country's language.  You can define a display table
  173. to work one language using such terminals.  For an example, see
  174. `lisp/iso-swed.el', which handles certain Swedish terminals.
  175.                                       You can load the appropriate
  176. display table for your terminal automatically by writing a
  177. terminal-specific Lisp file for the terminal type.
  178. File: elisp,  Node: Beeping,  Next: Window Systems,  Prev: Display Tables,  Up: Emacs Display
  179. Beeping
  180. =======
  181.                                       You can make Emacs ring a bell
  182. (or blink the screen) to attract the user's attention.  Be conservative
  183. about how often you do this; frequent bells can become irritating.
  184. Also be careful not to use beeping alone when signaling an error is
  185. appropriate.  (*Note Errors::.)
  186.                                     - Function: ding &optional
  187.                                              DONT-TERMINATE
  188.                                         This function beeps, or flashes
  189.                                         the screen (see `visible-bell'
  190.                                         below).  It also terminates any
  191.                                         keyboard macro currently
  192.                                         executing unless DONT-TERMINATE
  193.                                         is non-`nil'.
  194.                                     - Function: beep &optional
  195.                                              DONT-TERMINATE
  196.                                         This is a synonym for `ding'.
  197.                                     - Variable: visible-bell
  198.                                         This variable determines
  199.                                         whether Emacs should flash the
  200.                                         screen to represent a bell.
  201.                                         Non-`nil' means yes, `nil'
  202.                                         means no.  This is effective
  203.                                         only if the Termcap entry for
  204.                                         the terminal in use has the
  205.                                         visible bell flag (`vb') set.
  206. File: elisp,  Node: Window Systems,  Prev: Beeping,  Up: Emacs Display
  207. Window Systems
  208. ==============
  209.                                       Emacs works with several window
  210. systems, most notably X Windows.  Note that both Emacs and the X Window
  211. System use the term "window", but use it differently.  An Emacs frame
  212. is a single window as far as X Windows is concerned; the individual
  213. Emacs windows are not known to X Windows at all.
  214.                                     - Variable: window-system
  215.                                         This variable tells Lisp
  216.                                         programs what window system
  217.                                         Emacs is running under.  Its
  218.                                         value should be a symbol such
  219.                                         as `x' (if Emacs is running
  220.                                         under X Windows) or `nil' (if
  221.                                         Emacs is running on an ordinary
  222.                                         terminal).
  223.                                     - Variable: window-system-version
  224.                                         This variable distinguishes
  225.                                         between different versions of
  226.                                         the X Window System.  Its value
  227.                                         is 10 or 11 when using X
  228.                                         Windows; `nil' otherwise.
  229.                                     - Variable: window-setup-hook
  230.                                         This variable is a normal hook
  231.                                         which Emacs runs after loading
  232.                                         your `.emacs' file and the
  233.                                         default initialization file (if
  234.                                         any), after loading
  235.                                         terminal-specific Lisp code,
  236.                                         and after running the hook
  237.                                         `term-setup-hook'.
  238.                                         This hook is used for internal
  239.                                         purposes: setting up
  240.                                         communication with the window
  241.                                         system, and creating the
  242.                                         initial window.  Users should
  243.                                         not interfere with it.
  244. File: elisp,  Node: Calendar,  Next: Tips,  Prev: Emacs Display,  Up: Top
  245. Customizing the Calendar and Diary
  246. **********************************
  247.                                       There are many customizations
  248. that you can use to make the calendar and diary suit your personal
  249. tastes.
  250.                                    * Menu:
  251.                                    
  252.                                    * Calendar Customizing::   Defaults you can set.
  253.                                    * Holiday Customizing::    Defining your own holidays.
  254.                                    * Date Display Format::    Changing the format.
  255.                                    * Time Display Format::    Changing the format.
  256.                                    * Daylight Savings::       Changing the default.
  257.                                    * Diary Customizing::      Defaults you can set.
  258.                                    * Hebrew/Islamic Entries:: How to obtain them.
  259.                                    * Fancy Diary Display::    Enhancing the diary display, sorting entries.
  260.                                    * Including Diary Files::  Sharing a common diary file.
  261.                                    * Sexp Diary Entries::     Fancy things you can do.
  262.                                    * Appt Customizing::       Customizing appointment reminders.
  263. File: elisp,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar
  264. Customizing the Calendar
  265. ========================
  266.                                       If you set the variable
  267. `view-diary-entries-initially' to `t', calling up the calendar
  268. automatically displays the diary entries for the current date as well.
  269. The diary dates appear only if the current date is visible.  If you add
  270. both of the following lines to your `.emacs' file:
  271.                                         (setq view-diary-entries-initially t)
  272.                                         (calendar)
  273.                                    they display both the calendar and
  274. diary windows whenever you start Emacs.
  275.                                       Similarly, if you set the variable
  276. `view-calendar-holidays-initially' to `t', entering the calendar
  277. automatically displays a list of holidays for the current three month
  278. period.  The holiday list appears in a separate window.
  279.                                       You can set the variable
  280. `mark-diary-entries-in-calendar' to `t' in order to place a plus sign
  281. (`+') beside any dates with diary entries.  Whenever the calendar
  282. window is displayed or redisplayed, the diary entries are automatically
  283. marked for holidays.
  284.                                       Similarly, setting the variable
  285. `mark-holidays-in-calendar' to `t' places an asterisk (`*') after all
  286. holiday dates visible in the calendar window.
  287.                                       There are many customizations
  288. that you can make with the hooks provided.  For example, the variable
  289. `calendar-load-hook', whose default value is `nil', is a normal hook
  290. run when the calendar package is first loaded (before actually starting
  291. to display the calendar).
  292.                                       The variable
  293. `initial-calendar-window-hook', whose default value is `nil', is a
  294. normal hook run the first time the calendar window is displayed.  The
  295. function is invoked only when you first enter Calendar mode, not when
  296. you redisplay an existing Calendar window.  But if you leave the
  297. calendar with the `q' command and reenter it, the hook runs again.
  298.                                       The variable
  299. `today-visible-calendar-hook', whose default value is `nil', is a
  300. normal hook run after the calendar buffer has been prepared with the
  301. calendar when the current date is visible in the window.  One use of
  302. this hook is to replace today's date with asterisks; a function
  303. `calendar-star-date' is included for this purpose.  In your `.emacs'
  304. file, put:
  305.                                         (setq today-visible-calendar-hook 'calendar-star-date)
  306.                                    Another standard hook function adds
  307. asterisks around the current date.  Here's how to use it:
  308.                                         (setq today-visible-calendar-hook 'calendar-mark-today)
  309.                                    A corresponding variable,
  310. `today-invisible-calendar-hook', whose default value is `nil', is a
  311. normal hook run after the calendar buffer text has been prepared, if
  312. the current date is *not* visible in the window.
  313. File: elisp,  Node: Holiday Customizing,  Next: Date Display Format,  Prev: Calendar Customizing,  Up: Calendar
  314. Customizing the Holidays
  315. ========================
  316.                                       Emacs knows about holidays
  317. defined by entries on one of several lists.  You can customize theses
  318. lists of holidays to your own needs, adding holidays or deleting lists
  319. of holidays.  The lists of holidays that Emacs uses are for general
  320. holidays (`general-holidays'), local holidays (`local-holidays'),
  321. Christian holidays (`christian-holidays'), Hebrew (Jewish) holidays
  322. (`hebrew-holidays'), Islamic (Moslem) holidays (`islamic-holidays'),
  323. and other holidays (`other-holidays').
  324.                                       The general holidays are, by
  325. default, holidays common throughout the United States.  To eliminate
  326. these holidays, set `general-holidays' to `nil'.
  327.                                       There are no default local
  328. holidays (but sites may supply some).  You can set the variable
  329. `local-holidays' to any list of holidays, as described below.
  330.                                       By default, Emacs does not
  331. consider all the holidays of these religions, only those commonly found
  332. in secular calendars.  For a more extensive collection of religious
  333. holidays, you can set any (or all) of the variables
  334. `all-christian-calendar-holidays', `all-hebrew-calendar-holidays', or
  335. `all-islamic-calendar-holidays' to `t'.  If you want to eliminate the
  336. religious holidays, set any or all of the corresponding variables
  337. `christian-holidays', `hebrew-holidays', and `islamic-holidays' to
  338. `nil'.
  339.                                       You can set the variable
  340. `other-holidays' to any list of holidays.  This list, normally empty,
  341. is intended for your use.
  342.                                       Each of the lists
  343. (`general-holidays'), (`local-holidays'), (`christian-holidays'),
  344. (`hebrew-holidays'), (`islamic-holidays'),and (`other-holidays') is a
  345. list of "holiday forms", each holiday form describing a holiday (or
  346. sometimes a list of holidays).  Holiday forms may have the following
  347. formats:
  348.                                   `(fixed MONTH DAY STRING)'
  349.                                         A fixed date on the Gregorian
  350.                                         calendar.  MONTH and DAY are
  351.                                         numbers, STRING is the name of
  352.                                         the holiday.
  353.                                   `(float MONTH DAYNAME K STRING)'
  354.                                         The Kth DAYNAME in MONTH on the
  355.                                         Gregorian calendar (DAYNAME=0
  356.                                         for Sunday, and so on);
  357.                                         negative K means count back
  358.                                         from the end of the month.
  359.                                         sTRING is the name of the
  360.                                         holiday.
  361.                                   `(hebrew MONTH DAY STRING)'
  362.                                         A fixed date on the Hebrew
  363.                                         calendar.  MONTH and DAY are
  364.                                         numbers, STRING is the name of
  365.                                         the holiday.
  366.                                   `(islamic MONTH DAY STRING)'
  367.                                         A fixed date on the Islamic
  368.                                         calendar.  MONTH and DAY are
  369.                                         numbers, STRING is the name of
  370.                                         the holiday.
  371.                                   `(julian MONTH DAY STRING)'
  372.                                         A fixed date on the Julian
  373.                                         calendar.  MONTH and DAY are
  374.                                         numbers, STRING is the name of
  375.                                         the holiday.
  376.                                   `(sexp SEXP STRING)'
  377.                                         SEXP is a Lisp expression that
  378.                                         should use the variable `year'
  379.                                         to compute the date of a
  380.                                         holiday, or `nil' if the
  381.                                         holiday doesn't happen this
  382.                                         year.  The value represents the
  383.                                         date as a list of the form
  384.                                         `(MONTH DAY YEAR)'.  STRING is
  385.                                         the name of the holiday.
  386.                                   `(if BOOLEAN HOLIDAY-FORM &optional HOLIDAY-FORM)'
  387.                                         A choice between two holidays
  388.                                         based on the value of BOOLEAN.
  389.                                   `(FUNCTION &optional ARGS)'
  390.                                         Dates requiring special
  391.                                         computation; ARGS, if any, are
  392.                                         passed in a list to the
  393.                                         function
  394.                                         `calendar-holiday-function-function'.
  395.                                       For example, suppose you want to
  396. add Bastille Day, celebrated in France on July 14.  You can do this by
  397. adding the following line to your `.emacs' file:
  398.                                         (setq other-holidays '((fixed 7 14 "Bastille Day")))
  399.                                    The holiday form `(fixed 7 14
  400. "Bastille Day")' specifies the fourteenth day of the seventh month
  401. (July).
  402.                                       Many holidays occur on a specific
  403. day of the week, at a specific time of month.  Here is a holiday form
  404. describing Hurricane Supplication Day, celebrated in the Virgin Islands
  405. on the fourth Monday in August:
  406.                                         (float 8 1 4 "Hurricane Supplication Day")
  407.                                    Here the 8 specifies August, the 1
  408. specifies Monday (Sunday is 0, Tuesday is 2, and so on), and the 4
  409. specifies the fourth occurrence in the month (1 specifies the first
  410. occurrence, 2 the second occurrence, -1 the last occurrence, -2 the
  411. second-to-last occurrence, and so on).
  412.                                       You can specify holidays that
  413. occur on fixed days of the Hebrew, Islamic, and Julian calendars too.
  414. For example,
  415.                                         (setq other-holidays
  416.                                               '((hebrew 10 2 "Last day of Hanukkah")
  417.                                                 (islamic 3 12 "Mohammed's Birthday")
  418.                                                 (julian 4 2 "Jefferson's Birthday")))
  419.                                    adds the last day of Hanukkah (since
  420. the Hebrew months are numbered with 1 starting from Nisan), the Islamic
  421. feast celebrating Mohammed's birthday (since the Islamic months are
  422. numbered from 1 starting with Muharram), and Thomas Jefferson's
  423. birthday, which is 2 April 1743 on the Julian calendar.
  424.                                       To include a holiday
  425. conditionally, use either the `if' or the `sexp' form.  For example,
  426. American presidential elections occur on the first Tuesday after the
  427. first Monday in November of years divisible by 4:
  428.                                         (sexp (if (= 0 (% year 4))
  429.                                                   (calendar-gregorian-from-absolute
  430.                                                     (1+ (calendar-dayname-on-or-before
  431.                                                            1 (+ 6 (calendar-absolute-from-gregorian
  432.                                                                     (list 11 1 year))))))
  433.                                               "US Presidential Election"))
  434.                                    or
  435.                                         (if (= 0 (% displayed-year 4))
  436.                                             (fixed 11
  437.                                                    (extract-calendar-day
  438.                                                      (calendar-gregorian-from-absolute
  439.                                                        (1+ (calendar-dayname-on-or-before
  440.                                                              1 (+ 6 (calendar-absolute-from-gregorian
  441.                                                                       (list 11 1 displayed-year)))))))
  442.                                                    "US Presidential Election"))
  443.                                       Some holidays just don't fit into
  444. any of these forms because special calculations are involved in their
  445. determination.  In such cases you must write a Lisp function to do the
  446. calculation.  The function should return a (possibly empty) list of the
  447. relevant Gregorian dates among the range visible in the calendar
  448. window, with descriptive strings, like this:
  449.                                         (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
  450. File: elisp,  Node: Date Display Format,  Next: Time Display Format,  Prev: Holiday Customizing,  Up: Calendar
  451. Date Display Format
  452. ===================
  453.                                       You can customize the manner of
  454. displaying dates in the diary, in mode lines, and in messages by setting
  455. `calendar-date-display-form'.  This variable is a list of expressions
  456. that can involve the variables `month', `day', and `year', all numbers
  457. in string form, and `monthname' and `dayname', both alphabetic strings.
  458. In the American style, the default value of this list is as follows:
  459.                                         ((if dayname (concat dayname ", ")) monthname " " day ", " year)
  460.                                    while in the European style this
  461. value is the default:
  462.                                         ((if dayname (concat dayname ", ")) day " " monthname " " year)
  463.                                       The ISO standard date
  464. representation is this:
  465.                                         (year "-" month "-" day)
  466.                                    This specifies a typical American
  467. format:
  468.                                         (month "/" day "/" (substring year -2))
  469. File: elisp,  Node: Time Display Format,  Next: Daylight Savings,  Prev: Date Display Format,  Up: Calendar
  470. Time Display Format
  471. ===================
  472.                                       In the calendar, diary, and
  473. related buffers, Emacs displays times of day in the conventional
  474. American style with the hours from 1 through 12, minutes, and either
  475. `am' or `pm'.  If you prefer the "military" (European) style of writing
  476. times--in which the hours go from 00 to 23--you can alter the variable
  477. `calendar-time-display-form'.  This variable is a list of expressions
  478. that can involve the variables `12-hours', `24-hours', and `minutes',
  479. all numbers in string form, and `am-pm' and `time-zone', both
  480. alphabetic strings.  The default definition of
  481. `calendar-time-display-form' is as follows:
  482.                                         (12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")"))
  483.                                       Setting
  484. `calendar-time-display-form' to
  485.                                         (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))
  486.                                    gives military-style times like
  487. `21:07 (UT)' if time zone names are defined, and times like `21:07' if
  488. they are not.
  489. File: elisp,  Node: Daylight Savings,  Next: Diary Customizing,  Prev: Time Display Format,  Up: Calendar
  490. Daylight Savings Time
  491. =====================
  492.                                       Emacs understands the difference
  493. between standard time and daylight savings time--the times given for
  494. sunrise, sunset, solstices, equinoxes, and the phases of the moon take
  495. that into account.  The default starting and stopping dates for
  496. daylight savings time are the present-day American rules of the first
  497. Sunday in April until the last Sunday in October, but you can specify
  498. whatever rules you want by setting `calendar-daylight-savings-starts'
  499. and `calendar-daylight-savings-ends'.  Their values should be Lisp
  500. expressions that refer to the variable `year', and evaluate to the
  501. Gregorian date on which daylight savings time starts or (respectively)
  502. ends, in the form of a list `(MONTH DAY YEAR)'.
  503.                                       Emacs uses these expressions to
  504. determine the starting date of daylight savings time for the holiday
  505. list and for correcting times of day in the solar and lunar
  506. calculations.
  507.                                       The default value of
  508. `calendar-daylight-savings-starts' is this,
  509.                                         (calendar-nth-named-day 1 0 4 year)
  510.                                    which computes the first 0th day
  511. (Sunday) of the fourth month (April) in the year specified by `year'.
  512. If daylight savings time were changed to start on October 1, you would
  513. set `calendar-daylight-savings-starts' to
  514.                                         (list 10 1 year)
  515.                                       For a more complex example,
  516. suppose daylight savings time begins on the first of Nisan on the
  517. Hebrew calendar.  You would set `calendar-daylight-savings-starts' to
  518.                                         (calendar-gregorian-from-absolute
  519.                                           (calendar-absolute-from-hebrew
  520.                                             (list 1 1 (+ year 3760))))
  521.                                    because Nisan is the first month in
  522. the Hebrew calendar and the Hebrew year differs from the Gregorian year
  523. by 3760 at Nisan.
  524.                                       If there is no daylight savings
  525. time at your location, or if you want all times in standard time, set
  526. `calendar-daylight-savings-starts' and `calendar-daylight-savings-ends'
  527. to `nil'.
  528. File: elisp,  Node: Diary Customizing,  Next: Hebrew/Islamic Entries,  Prev: Daylight Savings,  Up: Calendar
  529. Customizing the Diary
  530. =====================
  531.                                       Ordinarily, the mode line of the
  532. diary buffer window indicates any holidays that fall on the date of the
  533. diary entries.  The process of checking for holidays can take several
  534. seconds, so including holiday information delays the display of the
  535. diary buffer noticeably.  If you'd prefer to have a faster display of
  536. the diary buffer but without the holiday information, set the variable
  537. `holidays-in-diary-buffer' to `nil'.
  538.                                       The variable
  539. `number-of-diary-entries' controls the number of days of diary entries
  540. to be displayed at one time.  It affects the initial display when
  541. `view-diary-entries-initially' is `t', as well as the command `M-x
  542. diary'.  For example, the default value is 1, which says to display
  543. only the current day's diary entries.  If the value is 2, both the
  544. current day's and the next day's entries are displayed.  The value can
  545. also be a vector of seven elements: if the value is `[0 2 2 2 2 4 1]'
  546. then no diary entries appear on Sunday, the current date's and the next
  547. day's diary entries appear Monday through Thursday, Friday through
  548. Monday's entries appear on Friday, while on Saturday only that day's
  549. entries appear.
  550.                                       The variable
  551. `print-diary-entries-hook' is a normal hook run after preparation of a
  552. temporary buffer containing just the diary entries currently visible in
  553. the diary buffer.  (The other, irrelevant diary entries are really
  554. absent from the temporary buffer; in the diary buffer, they are merely
  555. hidden.)  The default value of this hook does the printing with the
  556. command `lpr-buffer'.  If you want to use a different command to do the
  557. printing, just change the value of this hook.  Other uses might
  558. include, for example, rearranging the lines into order by day and time.
  559.                                       You can customize the form of
  560. dates in your diary file, if neither the standard American nor European
  561. styles suits your needs, by setting the variable `diary-date-forms'.
  562. This variable is a list of forms of dates recognized in the diary file.
  563. Each form is a list of regular expressions (*note Syntax of Regular
  564. Expressions: Rexgexps.) and the variables `month', `day', `year',
  565. `monthname', and `dayname'.  The variable `monthname' matchs the name
  566. of the month, capitalized or not, or its three-letter abbreviation,
  567. followed by a period or not; it matches `*'.  Similarly, `dayname'
  568. matchs the name of the day, capitalized or not, or its three-letter
  569. abbreviation, followed by a period or not.  The variables `month',
  570. `day', and `year' match those numerical values, preceded by arbitrarily
  571. many zeros; they also match `*'.  The default value of
  572. `diary-date-forms' in the American style is
  573.                                         ((month "/" day "[^/0-9]")
  574.                                          (month "/" day "/" year "[^0-9]")
  575.                                          (monthname " *" day "[^,0-9]")
  576.                                          (monthname " *" day ", *" year "[^0-9]")
  577.                                          (dayname "\\W"))
  578.                                    Emacs matches of the diary entries
  579. with the date forms is done with the standard syntax table from
  580. Fundamental mode (*note Syntax::.), but with the `*' changed so that it
  581. is a word constituent.
  582.                                       The forms on the list must be
  583. *mutually exclusive* and must not match any portion of the diary entry
  584. itself, just the date.  If, to be mutually exclusive, the pattern must
  585. match a portion of the diary entry itself, the first element of the
  586. form *must* be `backup'.  This causes the date recognizer to back up to
  587. the beginning of the current word of the diary entry.  Even if you use
  588. `backup', the form must absolutely not match more than a portion of the
  589. first word of the diary entry.  The default value of `diary-date-forms'
  590. in the European style is this list:
  591.                                         ((day "/" month "[^/0-9]")
  592.                                          (day "/" month "/" year "[^0-9]")
  593.                                          (backup day " *" monthname "\\W+\\<[^*0-9]")
  594.                                          (day " *" monthname " *" year "[^0-9]")
  595.                                          (dayname "\\W"))
  596.                                    Notice the use of `backup' in the
  597. middle form because part of the diary entry must be matched to
  598. distinguish this form from the following one.
  599. File: elisp,  Node: Hebrew/Islamic Entries,  Next: Fancy Diary Display,  Prev: Diary Customizing,  Up: Calendar
  600. Hebrew- and Islamic-Date Diary Entries
  601. ======================================
  602.                                       Your diary file can have entries
  603. based on Hebrew or Islamic dates, as well as entries based on our usual
  604. Gregorian calendar.  However, because the processing of such entries is
  605. time-consuming and most people don't need them, you must customize the
  606. processing of your diary file to specify that you want such entries
  607. recognized.  If you want Hebrew-date diary entries, for example, you
  608. must include these lines in your `.emacs' file:
  609.                                         (setq nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
  610.                                         (setq nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
  611.                                    If you want Islamic-date entries,
  612. include these lines in your `.emacs' file:
  613.                                         (setq nongregorian-diary-listing-hook 'list-islamic-diary-entries)
  614.                                         (setq nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
  615.                                    If you want both Hebrew- and
  616. Islamic-date entries, include these lines:
  617.                                         (setq nongregorian-diary-listing-hook
  618.                                               '(list-hebrew-diary-entries list-islamic-diary-entries))
  619.                                         (setq nongregorian-diary-marking-hook
  620.                                               '(mark-hebrew-diary-entries mark-islamic-diary-entries))
  621.                                       Hebrew- and Islamic-date diary
  622. entries have the same formats as Gregorian-date diary entries, except
  623. that the date must be preceded with an `H' for Hebrew dates and an `I'
  624. for Islamic dates.  Moreover, because the Hebrew and Islamic month
  625. names are not uniquely specified by the first three letters, you may
  626. not abbreviate them.  For example, a diary entry for the Hebrew date
  627. Heshvan 25 could look like
  628.                                         HHeshvan 25 Happy Hebrew birthday!
  629.                                    and would appear in the diary for
  630. any date that corresponds to Heshvan 25 on the Hebrew calendar.
  631. Similarly, an Islamic-date diary entry might be
  632.                                         IDhu al-Qada 25 Happy Islamic birthday!
  633.                                    and would appear in the diary for
  634. any date that corresponds to Dhu al-Qada 25 on the Islamic calendar.
  635.                                       As with Gregorian-date diary
  636. entries, Hebrew- and Islamic-date entries are nonmarking if they are
  637. preceded with an ampersand (`&').
  638.                                       There are commands to help you in
  639. making Hebrew- and Islamic-date entries to your diary:
  640.                                   `i h d'
  641.                                         Add a diary entry for the
  642.                                         Hebrew date corresponding to
  643.                                         the selected date
  644.                                         (`insert-hebrew-diary-entry').
  645.                                   `i h m'
  646.                                         Add a diary entry for the day
  647.                                         of the Hebrew month
  648.                                         corresponding to the selected
  649.                                         date
  650.                                         (`insert-monthly-hebrew-diary-entry').
  651.                                   `i h y'
  652.                                         Add a diary entry for the day
  653.                                         of the Hebrew year
  654.                                         corresponding to the selected
  655.                                         date
  656.                                         (`insert-yearly-hebrew-diary-entry').
  657.                                   `i i d'
  658.                                         Add a diary entry for the
  659.                                         Islamic date corresponding to
  660.                                         the selected date
  661.                                         (`insert-islamic-diary-entry').
  662.                                   `i i m'
  663.                                         Add a diary entry for the day
  664.                                         of the Islamic month
  665.                                         corresponding to the selected
  666.                                         date
  667.                                         (`insert-monthly-islamic-diary-entry').
  668.                                   `i i y'
  669.                                         Add a diary entry for the day
  670.                                         of the Islamic year
  671.                                         corresponding to the selected
  672.                                         date
  673.                                         (`insert-yearly-islamic-diary-entry').
  674.                                       These commands work exactly like
  675. the corresponding commands for ordinary diary entries: Move point to a
  676. date in the calendar window and the above commands insert the Hebrew or
  677. Islamic date (corresponding to the date indicated by point) at the end
  678. of your diary file and you can then type the diary entry.  If you want
  679. the diary entry to be nonmarking, give a numeric argument to the
  680. command.
  681. File: elisp,  Node: Fancy Diary Display,  Next: Including Diary Files,  Prev: Hebrew/Islamic Entries,  Up: Calendar
  682. Fancy Diary Display
  683. ===================
  684.                                       Diary display works by preparing
  685. the diary buffer and then running the hook `diary-display-hook'.  The
  686. default value of this hook hides the irrelevant diary entries and then
  687. displays the buffer (`simple-diary-display').  However, if you specify
  688. the hook as follows,
  689.                                         (add-hook 'diary-display-hook 'fancy-diary-display)
  690.                                    then fancy mode displays diary
  691. entries and holidays by copying them into a special buffer that exists
  692. only for display.  Copying provides an opportunity to change the
  693. displayed text to make it prettier--for example, to sort the entries by
  694. the dates they apply to.
  695.                                       As with simple diary display, you
  696. can print a hard copy of the buffer with `print-diary-entries'.  To
  697. print a hard copy of a day-by-day diary for a week by positioning point
  698. on Sunday of that week, type `7 d' and then do `M-x
  699. print-diary-entries'.  As usual, the inclusion of the holidays slows
  700. down the display slightly; you can speed things up by setting the
  701. variable `holidays-in-diary-buffer' to `nil'.
  702.                                       Ordinarily, the fancy diary
  703. buffer does not show days for which there are no diary entries, even if
  704. that day is a holiday.  If you want such days to be shown in the fancy
  705. diary buffer, set the variable `diary-list-include-blanks' to `t'.
  706.                                       If you use the fancy diary
  707. display, you can use the normal hook `list-diary-entries-hook' to sort
  708. each day's diary entries by their time of day.  Add this line to your
  709. `.emacs' file:
  710.                                         (add-hook 'list-diary-entries-hook 'sort-diary-entries)
  711.                                    For each day, this sorts diary
  712. entries that begin with a recognizable time of day according to their
  713. times.  Diary entries without times come first within each day.
  714. File: elisp,  Node: Included Diary Files
  715. Included Diary Files
  716. ====================
  717.                                       If you use the fancy diary
  718. display, you can have diary entries from other files included with your
  719. own by an "include" mechanism.  This facility makes possible the
  720. sharing of common diary files among groups of users.  Lines in the
  721. diary file of this form:
  722.                                         #include "FILENAME"
  723.                                    includes the diary entries from the
  724. file FILENAME in the fancy diary buffer (because the ordinary diary
  725. buffer is just the buffer associated with your diary file, you cannot
  726. use the include mechanism unless you use the fancy diary buffer).  The
  727. include mechanism is recursive, by the way, so that included files can
  728. include other files, and so on; you must be careful not to have a cycle
  729. of inclusions, of course.  To enable the include facility, add lines as
  730. follows to your `.emacs' file:
  731.                                         (add-hook 'list-diary-entries-hook 'include-other-diary-files)
  732.                                         (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
  733.